<template>
  <page-layout :title="'退款单号：'+detail.refundNo+'            退款时间：'+detail.createTime">
    <!-- actions -->
    <template v-if="detail.type==1" slot="action">
      <a-button-group style="margin-right: 4px;" v-if="detail.shopId=='A00001A00001'&&!detail.supplierId&&shopType==1">
        <!-- 1-1.平台初审-通过 -->
        <a-button v-if="detail.preStatus==0&&detail.status==1" @click="handleShopAddress(detail)">
          确认退货地址
        </a-button>
        <!-- 1-2.平台初审-拒绝 -->
        <a-button v-if="detail.preStatus==0&&detail.status==1" @click="handleMallRefuse(detail)">
          拒绝退款
        </a-button>
        <!-- 3-1.店铺处理-货物审核通过 》 平台终审 -->
        <a-button v-if="detail.preStatus==4&&detail.status==1" @click="handleMallLastAgree(detail)">
          审核通过
        </a-button>
        <!-- 3-2.店铺处理-货物审核拒绝 》 平台终审 -->
        <a-button v-if="detail.preStatus==4&&detail.status==1" @click="handleMallLastRefuse(detail)">
          拒绝退款
        </a-button>
      </a-button-group>
      <a-button-group style="margin-right: 4px;" v-else-if="detail.shopId=='A00001A00001'&&detail.supplierId">
        <!-- 1-1.平台初审-通过 -->
        <a-button v-if="detail.preStatus==0&&detail.status==1&&shopType==1" @click="handleMallAgree(detail)">审核通过
        </a-button>
        <!-- 1-2.平台初审-拒绝 -->
        <a-button v-if="detail.preStatus==0&&detail.status==1&&shopType==1" @click="handleMallRefuse(detail)">拒绝退款
        </a-button>
        <!-- 2-1.店铺处理-确认退货地址 》 待用户发货 -->
        <a-button v-if="detail.preStatus==1&&detail.status==1&&shopType==4" @click="handleShopAddress(detail)">确认退货地址
        </a-button>
        <!-- 3-1.店铺处理-货物审核通过 》 平台终审 -->
        <a-button v-if="detail.preStatus==4&&detail.status==1&&shopType==4" @click="handleShopGoodAgree(detail)">货物审核通过
        </a-button>
        <!-- 3-2.店铺处理-货物审核拒绝 》 平台终审 -->
        <a-button v-if="detail.preStatus==4&&detail.status==1&&shopType==4" @click="handleShopGoodRefuse(detail)">货物审核拒绝
        </a-button>
        <!-- 4-1.平台终审-通过 -->
        <a-button v-if="(detail.preStatus==5||detail.preStatus==6)&&detail.status==1&&shopType==1"
                  @click="handleMallLastAgree(detail)">审核通过
        </a-button>
        <!-- 4-2.平台终审-拒绝 -->
        <a-button v-if="(detail.preStatus==5||detail.preStatus==6)&&detail.status==1&&shopType==1"
                  @click="handleMallLastRefuse(detail)">拒绝退款
        </a-button>
      </a-button-group>
      <a-button-group style="margin-right: 4px;" v-else>

        <!-- 1-2.平台初审-拒绝 -->
        <a-button v-if="detail.preStatus==0&&detail.status==1&&shopType==3" @click="handleMallRefuse(detail,2)">拒绝退款
        </a-button>
        <!-- 2-1.店铺初审-确认退货地址 》 待用户发货 -->
        <a-button v-if="detail.preStatus==0&&detail.status==1&&shopType==3" @click="handleShopAddress(detail)">
          确认退货地址
        </a-button>
        <!-- 3-1.店铺处理-货物审核通过 》 平台终审 -->
        <!-- <a-button v-if="detail.preStatus==4&&detail.status==1&&shopType==3" @click="handleShopGoodAgree(detail)">货物审核通过
        </a-button> -->
        <!-- 4-1.平台终审-通过 -->
        <a-button
          v-if="(detail.preStatus==4||detail.preStatus==5||detail.preStatus==6)&&detail.status==1&&((shopType==1&&detail.shopId=='A00001A00001')||shopType==3)"
          @click="handleMallLastAgree(detail,2)">审核通过
        </a-button>
        <!-- 4-2.平台终审-拒绝 -->
        <a-button
          v-if="(detail.preStatus==4||detail.preStatus==5||detail.preStatus==6)&&detail.status==1&&((shopType==1&&detail.shopId=='A00001A00001')||shopType==3)"
          @click="handleMallLastRefuse(detail,2)">拒绝退款
        </a-button>
      </a-button-group>

      <!-- 关闭订单 -->
      <a-button @click="handleMallLastAgree(detail,null,1)"
                v-if="shopType==1&&detail.shopId!='A00001A00001'&&(detail.status==1||detail.status==3)">
        关闭订单
      </a-button>
    </template>
    <template v-if="detail.type==2" slot="action">
      <a-button-group style="margin-right: 4px;">
        <!-- 4-1.平台终审-通过 -->
        <a-button @click="handleMallLastAgree(detail)"
                  v-if="detail.preStatus==0&&detail.status==1&&((shopType==1&&detail.shopId=='A00001A00001')||shopType==3)">
          审核通过
        </a-button>
        <!-- 4-2.平台终审-拒绝 -->
        <a-button
          v-if="detail.preStatus==0&&detail.status==1&&((shopType==1&&detail.shopId=='A00001A00001')||shopType==3)"
          @click="handleMallLastRefuse(detail)">拒绝退款
        </a-button>
      </a-button-group>
      <!-- 关闭订单 -->
      <a-button @click="handleMallLastAgree(detail,null,1)"
                v-if="shopType==1&&detail.shopId!='A00001A00001'&&(detail.status==1||detail.status==3)">
        关闭订单
      </a-button>
    </template>
    <a-row slot="extra" class="status-list">
      <a-col :xs="24" :sm="24">
        <div class="text">退款状态</div>
        <div class="heading">{{ detail.status == 1 ? detail.preStatus_dictText : detail.status_dictText }}</div>
        <div class="text-red" v-if="detail.isClose==1">平台关闭了订单，<a @click="lookInfo()">查看详情</a></div>
      </a-col>
    </a-row>
    <detail-list slot="headerContent" size="small">
      <detail-list-item term="申请人">{{ detail.member.nickname }}</detail-list-item>
      <detail-list-item term="退款方式">{{ detail.type == 1 ? "退货退款" : "仅退款" }}</detail-list-item>
      <detail-list-item term="退款金额">{{ detail.refundPrice|numToFixed2 }}</detail-list-item>
      <detail-list-item term="运费">{{ detail.freight }}</detail-list-item>
      <detail-list-item term="收货状态">{{ detail.goodsStatus == 1 ? "已收到货" : "未收到货" }}</detail-list-item>
      <detail-list-item term="联系方式">{{ detail.member.phone }}</detail-list-item>
      <detail-list-item term="退款原因">{{ detail.reason }}</detail-list-item>
      <detail-list-item term="退款备注">{{ detail.remark }}</detail-list-item>
    </detail-list>

    <a-row v-if="detail.isSetAddress==1&&detail.addressInfoObj">
      <a-col :xs="24" :sm="24">
        <a-card title="退货地址" size="small">
          <detail-list :col="2">
            <detail-list-item term="联系人">{{ detail.addressInfoObj.name }}</detail-list-item>
            <detail-list-item term="联系电话">{{ detail.addressInfoObj.tel }}</detail-list-item>
            <detail-list-item term="退货地址">{{ detail.addressInfoObj.fullName }}</detail-list-item>
          </detail-list>
        </a-card>
      </a-col>
    </a-row>

    <!-- 购买信息 -->
    <a-card title="商品信息" size="small" style="margin-top: 15px">
      <a-table :columns="goodsColumns" bordered :dataSource="detail.orderSkuList" :pagination="false" size="small">

        <template slot="priceSlot" slot-scope="text,record">
            <span v-if="shopType==4">
                {{ record.subSupplyPrice /record.num }}
            </span>
          <span v-else>
                {{ text }}
            </span>
        </template>

        <template slot="shopName">
          {{ detail.shop ? detail.shop.name : '' }}
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else height="55px" :src="text" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <!-- <template slot="freight">
          {{detail.freight}}
        </template> -->
        <template slot="subTotal" slot-scope="text,record">
          <div v-if="shopType==4">
            {{ record.subSupplyPrice }}
          </div>
          <div v-else>
            <span>{{ (record.subTotal * 1 + record.changePrice * 1).toFixed(2) }}</span>
            <span style="padding-left:10px;" v-if="record.changePrice*1>0||record.changePrice*1<0">
            <a-tooltip>
              <template slot="title">
                原价：{{ record.subTotal }}
              </template>
              <a-icon type="exclamation-circle"/>
            </a-tooltip>
          </span>
          </div>
        </template>

      </a-table>
    </a-card>
    <!-- 退款协商记录 -->
    <a-card title="协商记录" size="small" style="margin-top: 15px">
      <div class="rfB4s" v-for="(item,index) in detail.omsRefundLogList" :key="index">
        <div class="rfB4s-head">
          <span class="rfB4s-head1" v-if="item.type==1">买</span>
          <span class="rfB4s-head2" v-if="item.type==2">商</span>
          <span class="rfB4s-head3" v-if="item.type==3">平</span>
        </div>
        <div class="rfB4s-con">

          <div class="rfB4s-con-1">
            <span>
              <span v-if="item.type==1" style="color:blue">买家</span>
              <span v-if="item.type==2" style="color:green">商家</span>
              <span v-if="item.type==3" style="color:orange">平台</span>
              &nbsp;
              {{ item.title }}
            </span>
            <span>{{ item.createTime }}</span>
          </div>

          <div class="rfB4s-con-2" v-if="item.type==1&&item.status==0">
            <div class="rfB4s-con-2t">退款方式：
              <div class="rfB4s-con-2ts">{{ detail.type == 1 ? '退款退货' : '仅退款' }}</div>
            </div>
            <div class="rfB4s-con-2t" v-if="shopType==4">退款金额：
              <div class="rfB4s-con-2ts">￥ {{ calculateSupplierTotal(detail.orderSkuList) }}</div>
            </div>
            <div class="rfB4s-con-2t" v-else>退款金额：
              <div class="rfB4s-con-2ts">￥{{ item.refundPrice }}</div>
            </div>
            <div class="rfB4s-con-2t">联系方式：
              <div class="rfB4s-con-2ts">{{ detail.member.phone }}</div>
            </div>
            <div class="rfB4s-con-2t">退款原因：
              <div class="rfB4s-con-2ts">{{ item.reason }}</div>
            </div>
            <div class="rfB4s-con-2t">退款备注：
              <div class="rfB4s-con-2ts">{{ item.remark }}</div>
            </div>
            <div class="rfB4s-con-2t">凭证：
              <div class="rfB4s-con-2ts" v-if="item.imgUrls">
                <img v-for="(ite,index) in item.imgUrlsObj" :key="index" :src="ite" @click="openUrlView(ite)"
                     style="width: 100px;">
              </div>
            </div>
          </div>

          <div class="rfB4s-con-2" v-if="item.type==2&&item.status==3&&detail.addressInfoObj">
            <div class="rfB4s-con-2t">联系电话：
              <div class="rfB4s-con-2ts">{{ detail.addressInfoObj.tel }}</div>
            </div>
            <div class="rfB4s-con-2t">联系人：
              <div class="rfB4s-con-2ts">{{ detail.addressInfoObj.name }}</div>
            </div>
            <div class="rfB4s-con-2t">退货地址：
              <div class="rfB4s-con-2ts">{{ detail.addressInfoObj.fullName }}</div>
            </div>
          </div>
          <div class="rfB4s-con-2" v-if="item.type==1&&item.status==4">
            <div class="rfB4s-con-2t">物流公司：
              <div class="rfB4s-con-2ts">{{ item.logisticsCompany }}</div>
            </div>
            <div class="rfB4s-con-2t">物流单号：
              <div class="rfB4s-con-2ts">{{ item.logisticsNo }}</div>
            </div>
            <div class="rfB4s-con-2t">填写时间：
              <div class="rfB4s-con-2ts">{{ item.logisticsTime }}</div>
            </div>
            <div class="rfB4s-con-2t">物流凭证：
              <div class="rfB4s-con-2ts" v-if="item.logisticsImgUrls">
                <img v-for="(ite,index) in item.logisticsImgUrlsObj" :key="index" :src="ite" @click="openUrlView(ite)"
                     style="width: 100px;height: auto;display:block;">
              </div>
            </div>
          </div>
        </div>

      </div>

    </a-card>

    <!-- 平台初审-拒绝 -->
    <a-modal title="拒绝原因" :visible="mallRefuseVisible" :confirm-loading="confirmLoading" @ok="handleMallRefuseOk"
             @cancel="mallRefuseVisible= false">
      拒绝原因：
      <a-input placeholder="请输入拒绝原因" v-model="refuseReason"/>
    </a-modal>
    <!-- 店铺处理-确认退款地址 -->
    <a-modal title="确认退款地址" :visible="shopAddressVisible" :confirm-loading="confirmLoading" @ok="handleShopAddressOk"
             @cancel="shopAddressVisible= false">
      退款地址：
      <a-input style="height:0px;height:0px;opacity: 0;" placeholder="请输入退款地址id" v-model="addressId"/>
      <a-input placeholder="请选择退款地址" :disabled="true" v-model="name"/>
      <a-input placeholder="请选择退款地址" :disabled="true" v-model="tel"/>
      <a-input placeholder="请选择退款地址" :disabled="true" v-model="postCode"/>
      <a-input placeholder="请选择退款地址" :disabled="true" v-model="addressName"/>
      <a-button style="margin:10px 0;" @click="addressSelect">选择地址</a-button>
    </a-modal>
    <!-- 店铺处理-货物审核拒绝 -->
    <a-modal title="拒绝原因" :visible="shopGoodRefuseVisible" :confirm-loading="confirmLoading"
             @ok="handleShopGoodRefuseOk"
             @cancel="shopGoodRefuseVisible= false">
      拒绝原因：
      <a-input placeholder="请输入拒绝原因" v-model="refuseReason"/>
    </a-modal>
    <!-- 平台终审-通过 -->
    <a-modal :title="isClose==1?'关闭退款单':'同意退款'" :visible="mallLastAgreeVisible" :confirm-loading="confirmLoading"
             @ok="handleMallLastAgreeOk"
             @cancel="mallLastAgreeVisible= false">
      <!-- <div>
        订单金额：{{max_refund_amount}}
      </div> -->
      <div>
        退款金额：
        <a-input-number placeholder="请输入退款金额" :min="0.01" :precision="2" v-model="refundPrice"
                        :max="max_refund_amount"/>
      </div>
      <div v-if="isClose==1" style="margin-top:15px;">
        处理备注：
        <a-input placeholder="请输入关闭原因" v-model="closeReason"/>
      </div>
    </a-modal>
    <!-- 平台初审-拒绝 -->
    <a-modal title="拒绝原因" :visible="mallLastRefuseVisible" :confirm-loading="confirmLoading"
             @ok="handleMallLastRefuseOk"
             @cancel="mallLastRefuseVisible= false">
      拒绝原因：
      <a-input placeholder="请输入拒绝原因" v-model="refuseReason"/>
    </a-modal>
    <a-modal title="关闭详情" :visible="closeVisible" @ok="closeVisible=false" @cancel="closeVisible= false">
      <!-- <div>
        订单金额：{{max_refund_amount}}
      </div> -->
      <div>
        退款金额：{{ detail.refundPrice }}
      </div>
      <div style="margin-top:15px;">
        处理备注：{{ detail.closeReason }}
      </div>
    </a-modal>

    <oms-refund-address-ref ref="modalGoodsSet" @ok=" modalGoodsOk"/>
  </page-layout>
</template>

<script>
import Vue from 'vue'
import {SHOP_TYPE, ORG_CODE} from "@/store/mutation-types"
import {postAction, getAction} from '@/api/manage'
import {mixinDevice} from '@/utils/mixin.js'
import PageLayout from '@/components/page/PageLayout'
import DetailList from '@/components/tools/DetailList'
import OmsRefundAddressRef from '@/views/gospel/mallBase/shop/modules/OmsRefundAddressRef'

const DetailListItem = DetailList.Item
export default {
  name: "Advanced",
  components: {
    PageLayout,
    DetailList,
    DetailListItem,
    OmsRefundAddressRef
  },
  mixins: [mixinDevice],
  data() {
    return {
      //当前用户店铺类型1:平台，2：自营，3：店铺，4：供应商
      shopType: Vue.ls.get(SHOP_TYPE),
      //当前用户部门code
      orgCode: Vue.ls.get(ORG_CODE),
      confirmLoading: false,
      mallRefuseVisible: false,
      refuseReason: '',
      shopAddressVisible: false,
      addressId: '',
      name: '',
      tel: '',
      postCode: '',
      addressName: '',
      def_addressId: '',
      def_name: '',
      def_tel: '',
      def_postCode: '',
      def_addressName: '',
      shopGoodRefuseVisible: false,
      mallLastAgreeVisible: false,
      refundPrice: 0,
      max_refund_amount: 0,
      mallLastRefuseVisible: false,
      closeVisible: false,
      detail: {
        addressInfoObj: {},
        orderSkuList: [],
        omsRefundLogList: [],
        member: {}
      },
      goodsColumns: [
        {
          title: '店铺',
          dataIndex: 'id',
          key: 'id',
          scopedSlots: {customRender: 'shopName'},
        },
        {
          title: '商品图片',
          dataIndex: 'imgUrl',
          key: 'imgUrl',
          scopedSlots: {customRender: 'imgSlot'},
        },
        {
          title: '商品标题',
          dataIndex: 'spuName',
          key: 'spuName'
        },
        {
          title: '规格',
          dataIndex: 'skuName',
          key: 'skuName'
        },
        {
          title: '单价',
          dataIndex: 'skuPrice',
          key: 'skuPrice',
          scopedSlots: {customRender: 'priceSlot'}
        },
        {
          title: '数量',
          dataIndex: 'num',
          key: 'num'
        },
        {
          title: '店铺优惠',
          dataIndex: 'shopCouponDiscount',
          key: 'shopCouponDiscount'
        },
        {
          title: '平台优惠',
          dataIndex: 'couponDiscount',
          key: 'couponDiscount'
        },
        {
          title: '积分抵扣',
          dataIndex: 'integralDiscount',
          key: 'integralDiscount'
        },
        // {
        //   title: '运费',
        //   dataIndex: 'freight',
        //   key: 'freight',
        //   scopedSlots: { customRender: 'freight' }
        // },
        {
          title: '小计(元)',
          dataIndex: 'subTotal',
          key: 'subTotal',
          scopedSlots: {customRender: 'subTotal'}
        }

      ],
      type: null,//处理人类型：1:买家 2：店铺 3:平台
      isClose: null,//是否平台关闭
      closeReason: null,//关闭原因
      supplierTotalRefundPrice: 0,
    }
  },
  filters: {
    timestampToTime(timestamp) {
      var date = new Date(Number(timestamp))//时间戳为10位需*1000，时间戳为13位的话不需乘1000
      var Y = date.getFullYear() + '-'
      var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
      var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
      var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
      var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
      var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
      var strDate = Y + M + D + h + m + s
      return strDate//2020-07-30 01:05:54
    }
  },
  methods: {
    calculateSupplierTotal: function (record) {
      let price = 0;
      for (let i = 0; i < record.length; i++) {
        price += record[i].subSupplyPrice;
      }
      return price;
    },
    lookInfo() {
      this.closeVisible = true
    },
    getDefaultAddr() {
      let self = this
      getAction("/mallBase/omsRefundAddress/list", {
        column: 'isTop',
        order: 'desc',
        pageNo: 1,
        pageSize: 1,
        isTop: 1
      }).then(res => {
        if (res.success) {
          if (res.result.records.length > 0) {
            self.def_addressId = res.result.records[0].id
            self.def_name = res.result.records[0].name
            self.def_tel = res.result.records[0].tel
            self.def_postCode = res.result.records[0].postCode
            self.def_addressName = res.result.records[0].fullName
          }
        } else {
          this.$message.error(res.message)
        }
      })
    },
    addressSelect() {
      let self = this
      self.$refs.modalGoodsSet.visible = true
      self.$refs.modalGoodsSet.open()
    },
    modalGoodsOk(row) {
      const self = this
      self.addressId = row.id
      self.name = row.name
      self.tel = row.tel
      self.postCode = row.postCode
      self.addressName = row.fullName
    },
    openUrlView(text) {
      console.log(0)
      this.$info({
        title: '预览',
        width: 600,
        okText: '关闭',
        content: h => <div style="margin-left:-70px;margin-right:-32px;"><img src={text} width="100%"/></div>,
        onOk() {
          console.log('OK')
        },
        onCancel() {
          console.log('Cancel')
        }
      })
    },
    modalFormOk() {
      // 新增/修改 成功时，重载列表
      this.$emit('ok')
    },

    edit(record) {
      console.log(1313232)
      console.log(record)
      this.detail = Object.assign({}, record)
      this.getDefaultAddr()
      this.visible = true
    },
    // 1-1.平台初审-通过 》 店铺处理-确认退款地址
    handleMallAgree(item) {
      var self = this
      self.$confirm({
        title: '操作提醒',
        content: '确定要同意退款吗?',
        onOk() {
          self.confirmLoading = true
          postAction('/mallBase/omsOrderRefund/mall-agree-one', {
            refundNo: self.detail.refundNo
          }).then(res => {
            self.modalFormOk()
          }).finally(() => {
            self.confirmLoading = false
          })
        },
        onCancel() {
          // console.log('Cancel')
        }
      })
    },
    // 1-2.平台初审-拒绝 》 待用户关闭或重新提交
    handleMallRefuse(item, type) {
      var self = this
      self.mallRefuseVisible = true
      self.refuseReason = ''
      if (type) {
        self.type = type
      }
    },
    handleMallRefuseOk(item) {
      var self = this
      if (!self.refuseReason) {
        self.$message.warning("请先输入拒绝原因")
        return
      }
      self.$confirm({
        title: '操作提醒',
        content: '确定要拒绝退款吗?',
        onOk() {
          self.confirmLoading = true
          postAction('/mallBase/omsOrderRefund/mall-refuse-one', {
            refundNo: self.detail.refundNo,
            refuseReason: self.refuseReason,
            type: self.type
          }).then(res => {
            self.modalFormOk()
          }).finally(() => {
            self.mallRefuseVisible = false
            self.confirmLoading = false
          })
        },
        onCancel() {
          // console.log('Cancel')
        }
      })
    },
    // 2-1.店铺处理-确认退货地址 》 待用户发货
    handleShopAddress(item) {
      var self = this
      self.shopAddressVisible = true
      self.addressId = self.def_addressId + ""
      self.name = self.def_name + ""
      self.tel = self.def_tel + ""
      self.postCode = self.def_postCode + ""
      self.addressName = self.def_addressName + ""
    },
    handleShopAddressOk(item) {
      var self = this
      if (!self.addressId) {
        self.$message.warning("请先选择正确退货地址")
        return
      }
      self.$confirm({
        title: '操作提醒',
        content: '确定已选择正确退货地址?',
        onOk() {
          self.confirmLoading = true
          postAction('/mallBase/omsOrderRefund/shop-address', {
            refundNo: self.detail.refundNo,
            addressId: self.addressId
          }).then(res => {
            self.modalFormOk()
          }).finally(() => {
            self.shopAddressVisible = false
            self.confirmLoading = false
          })
        },
        onCancel() {
          // console.log('Cancel')
        }
      })
    },
    // 3-1.店铺处理-货物审核通过 》 平台终审
    handleShopGoodAgree(item) {
      var self = this
      self.$confirm({
        title: '操作提醒',
        content: '确定退回货物审核通过吗?',
        onOk() {
          self.confirmLoading = true
          postAction('/mallBase/omsOrderRefund/shop-good-agree', {
            refundNo: self.detail.refundNo
          }).then(res => {
            self.modalFormOk()
          }).finally(() => {
            self.confirmLoading = false
          })
        },
        onCancel() {
          // console.log('Cancel')
        }
      })
    },
    // 3-1.店铺处理-货物审核拒绝 》 平台终审
    handleShopGoodRefuse(item) {
      var self = this
      self.shopGoodRefuseVisible = true
      self.refuseReason = ''
    },
    handleShopGoodRefuseOk(item) {
      var self = this
      if (!self.refuseReason) {
        self.$message.warning("请先输入拒绝原因")
        return
      }
      self.$confirm({
        title: '操作提醒',
        content: '确定要拒绝退款吗?',
        onOk() {
          self.confirmLoading = true
          postAction('/mallBase/omsOrderRefund/shop-good-refuse', {
            refundNo: self.detail.refundNo,
            refuseReason: self.refuseReason
          }).then(res => {
            self.modalFormOk()
          }).finally(() => {
            self.shopGoodRefuseVisible = false
            self.confirmLoading = false
          })
        },
        onCancel() {
          // console.log('Cancel')
        }
      })
    },
    // 4-1.平台终审-通过 》 退款订单关闭
    handleMallLastAgree(item, type, isClose) {
      var self = this
      self.mallLastAgreeVisible = true
      self.max_refund_amount = item.refundPrice
      self.refundPrice = item.refundPrice
      if (type) {
        self.type = type
      }
      if (isClose) {
        self.isClose = isClose
        self.closeReason = ""
      }
    },
    handleMallLastAgreeOk(item) {
      var self = this
      if (!self.refundPrice) {
        self.$message.success("请先输入退款金额")
        return
      }
      self.$confirm({
        title: '操作提醒',
        content: '确定要同意退款吗?',
        onOk() {
          self.confirmLoading = true
          postAction('/mallBase/omsOrderRefund/mall-agree-end', {
            refundNo: self.detail.refundNo,
            refundPrice: self.refundPrice,
            type: self.type,
            isClose: self.isClose,
            closeReason: self.closeReason
          }).then(res => {
            self.modalFormOk()
          }).finally(() => {
            self.mallLastAgreeVisible = false
            self.confirmLoading = false
          })
        },
        onCancel() {
          // console.log('Cancel')
        }
      })
    },
    // 4-2.平台终审-拒绝 》 待用户关闭
    handleMallLastRefuse(item, type) {
      var self = this
      self.mallLastRefuseVisible = true
      self.refuseReason = ''
      if (type) {
        self.type = type
      }
    },
    handleMallLastRefuseOk(item) {
      var self = this
      if (!self.refuseReason) {
        self.$message.warning("请先输入拒绝原因")
        return
      }
      self.$confirm({
        title: '操作提醒',
        content: '确定要拒绝退款吗?',
        onOk() {
          self.confirmLoading = true
          postAction('/mallBase/omsOrderRefund/mall-refuse-end', {
            refundNo: self.detail.refundNo,
            refuseReason: self.refuseReason,
            type: self.type
          }).then(res => {
            self.modalFormOk()
          }).finally(() => {
            self.mallLastRefuseVisible = false
            self.confirmLoading = false
          })
        },
        onCancel() {
          // console.log('Cancel')
        }
      })
    },

  },

}
</script>

<style lang="less" scoped>
.detail-layout {
  margin-left: 44px;
}

.text {
  color: rgba(0, 0, 0, 0.45);
}

.heading {
  color: rgba(0, 0, 0, 0.85);
  font-size: 20px;
}

.text-red {
  color: red;
}

.no-data {
  color: rgba(0, 0, 0, 0.25);
  text-align: center;
  line-height: 64px;
  font-size: 16px;

  i {
    font-size: 24px;
    margin-right: 16px;
    position: relative;
    top: 3px;
  }
}

.mobile {
  .detail-layout {
    margin-left: unset;
  }

  .text {
  }

  .status-list {
    text-align: left;
  }
}

.rfB4s {
  width: 100%;
  position: relative;
  display: flex;
  margin-top: 10px;

  .rfB4s-head {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin: 0 15px;
    text-align: center;
    line-height: 50px;
    overflow: hidden;
    color: white;
    font-size: 18px;

    .rfB4s-head1 {
      display: inline-block;
      width: 100%;
      height: 100%;
      background: blue;
    }

    .rfB4s-head2 {
      display: inline-block;
      width: 100%;
      height: 100%;
      background: green;
    }

    .rfB4s-head3 {
      display: inline-block;
      width: 100%;
      height: 100%;
      background: orange;
    }
  }

  .rfB4s-con {
    flex: 1;
    background: rgba(95, 93, 93, 0.05);
    min-height: 50px;
    padding: 0 16px;
    box-sizing: border-box;

    .rfB4s-con-1 {
      width: 100%;
      height: 50px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .rfB4s-con-2 {
      width: 100%;
      border-top: 1px solid #999;

      .rfB4s-con-2t {
        margin-top: 15px;
        width: 100%;
        display: flex;

        .rfB4s-con-2ts {
          flex: 1;
          display: flex;
          flex-wrap: wrap;
          // img{
          //   width: 150px;
          //   height: 150px;
          //   margin: 5px;
          // }
        }
      }
    }
  }
}
</style>
